package com.gx303.wximageselect;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.ListView;

import java.util.List;

import com.gx303.wximageselect.adapter.FolderAdapter;
import com.gx303.wxselectlibrary.R;


public class PopWxImageSelectFolder extends Activity {

    ListView listView1;
    Button btn_cancel;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pop_wx_image_select_folder);
        init();
//        datas.setSelectImageNull();
        FolderAdapter adapter=new FolderAdapter(getApplicationContext());
        adapter.setData(datas.folders);
        listView1.setAdapter(adapter);
        listView1.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				// TODO Auto-generated method stub
					Intent it_selectImage=new Intent();
					if(arg2==0)
					{
						//所有图片
						it_selectImage.putExtra(PopWxImageSelectFromXc.EXTRA_ALL_OR_FOLDER, true);
					}
					else
					{
						
						it_selectImage.putExtra(PopWxImageSelectFromXc.EXTRA_ALL_OR_FOLDER, false);
						//单个文件夹
						it_selectImage.putExtra(PopWxImageSelectFromXc.EXTRA_SELECT_FOLDER, datas.folders.get(arg2-1));
						
					}
					it_selectImage.setClass(getApplicationContext(), PopWxImageSelectFromXc.class);
					startActivity(it_selectImage);
					finish();
			}
		});
    }
    public void init()
    {
        btn_cancel=(Button)findViewById(R.id.btn_cancel);
        listView1=(ListView)findViewById(R.id.listView1);
    }




}
